export { default as FormModal } from './FormModal.vue'
export { default as SearchForm } from './SearchForm.vue'
export { default as ViewModal } from './ViewModal.vue'

/** 时间区间是否小于指定小时 */
export function isLessThanHour(targetHour: number, overnightShift: number, time: string[]) {
  const [start, end] = time
  const { hour } = getWorkerHours(
    start!,
    end!,
    overnightShift,
  )
  const h = Math.floor(Math.abs(hour))
  console.log('h:', h)
  return h <= targetHour - 1
}
/** 获取区间间隔 时、分 */
export function getWorkerHours(startTime: string, endTime: string, overnightShift?: number) {
  const current = formatTime(Date.now(), 'YYYY/MM/DD')
  const start = new Date(`${current} ${startTime!}`)
  const end = new Date(`${current} ${endTime!}`)
  if (overnightShift) {
    end.setDate(end.getDate() + 1)
  }
  const timestamp = end.getTime() - start.getTime()
  // console.log(timestamp, start, end);
  const hour = Math.floor(timestamp / 3600000)
  const minute = Math.floor((timestamp % 3600000) / 60000)
  return {
    hour,
    minute,
  }
}
